<!--
 * @Description: 
 * @version: 
 * @Author: liurui
 * @Date: 2024-02-19 10:54:24
 * @LastEditors: 
 * @LastEditTime: 2024-02-19 11:15:27
-->
<template>
    <div>

    </div>
</template>

<script setup lang="ts">
// 给定一个正整数作为类型的参数，要求返回的类型是该数字减 1

type Zero = MinusOne<1>; // 0
type FiftyFour = MinusOne<55>; // 54

// 借助元组的长度进行计数
type MinusOne<T extends number, Arr extends any[] = []> = [
  ...Arr,
  1,
]['length'] extends T
  ? Arr['length']
  : MinusOne<T, [...Arr, 1]>;
</script>

<style scoped>

</style>